* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: #2d3748;
    background-color: #f7fafc;
    height: 100vh;
}

.header {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(74, 85, 104, 0.1);
}

.header h1 {
    margin-left: 10px;
    font-size: 40px;
    color: #2d3748;
}

.main-container {
    display: flex;
    height: calc(100vh - 150px);
}

.function-sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e2e8f0;
    padding: 20px;
    overflow-y: auto;
}

.function-sidebar h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #4a5568;
}

.function-item {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.function-item:hover {
    border-color: #4299e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.15);
}

.function-item.active {
    border-color: #4299e1;
    background: linear-gradient(135deg, #ebf8ff 0%, #bee3f8 100%);
}

.function-item h4 {
    font-size: 16px;
    margin-bottom: 8px;
    color: #2d3748;
}

.function-item p {
    font-size: 14px;
    color: #718096;
}

.function-icon {
    margin-right: 8px;
}

.resources-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.resources-header {
    text-align: center;
    margin-bottom: 30px;
}

.resources-header h2 {
    font-size: 32px;
    color: #2d3748;
    margin-bottom: 10px;
}

.resources-header p {
    font-size: 18px;
    color: #718096;
}

.search-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-container {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #4299e1;
}

.search-button {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
}

.search-button:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-tag {
    background: #f1f5f9;
    color: #475569;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.filter-tag:hover, .filter-tag.active {
    background: #4299e1;
    color: white;
    border-color: #3182ce;
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.resource-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.resource-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.resource-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
}

.resource-type.girl {
    background: #fef5f9; /* 柔粉红，温柔甜美，但不刺眼 */
    color: #9d3b5c; /* 深玫瑰色，优雅柔和 */
}

.resource-type.boy {
    background: #f0f6ff; /* 浅天蓝，清爽干净，象征探索与广阔 */
    color: #2563eb; /* 深蓝色，稳重但不失活力 */
}

.resource-type.trouble {
    background: #f8f5f0; /* 中性米灰，温暖包容，适合“烦恼”主题 */
    color: #57534e; /* 暖灰褐，温和低刺激，减少焦虑感 */
}

.resource-type.knowledge {
    background: #f0faf4; /* 浅青绿，象征成长🌱与希望 */
    color: #166534; /* 深绿，自然沉静，利于学习氛围 */
}

.resource-title {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
    line-height: 1.4;
}

.resource-description {
    color: #718096;
    font-size: 14px;
    margin-bottom: 12px;
    line-height: 1.5;
}

.resource-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #a0aec0;
    font-size: 12px;
}

.resource-duration {
    display: flex;
    align-items: center;
    gap: 4px;
}

.resource-rating {
    display: flex;
    align-items: center;
    gap: 4px;
}

.categories-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.categories-title {
    font-size: 20px;
    color: #2d3748;
    margin-bottom: 15px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.category-item {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-item:hover {
    border-color: #4299e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.15);
}

.category-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.category-name {
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 4px;
}

.category-count {
    color: #718096;
    font-size: 12px;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.pagination button {
    background: white;
    border: 2px solid #e2e8f0;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination button:hover {
    border-color: #4299e1;
    background: #ebf8ff;
}

.pagination button.active {
    background: #4299e1;
    color: white;
    border-color: #3182ce;
}

.footer {
    background: #f9fafb;
    color: #6b7280;
    text-align: center;
    padding: 20px;
    margin-top: auto;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 800px;
    margin: 50px auto;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 24px;
    color: #2d3748;
}

.close-button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #718096;
}

.modal-body {
    line-height: 1.6;
    color: #4a5568;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.action-button {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.view-button {
    background: #4299e1;
    color: white;
}

.view-button:hover {
    background: #3182ce;
}

.download-button {
    background: #48bb78;
    color: white;
}

.download-button:hover {
    background: #38a169;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: #718096;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4299e1;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.error-message {
    background: #fed7d7;
    color: #c53030;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.preview-content {
    background: #f7fafc;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.6;
}

.data-source-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    z-index: 1001;
}

.data-source-api {
    background: #c6f6d5;
    color: #22543d;
}

.data-source-mock {
    background: #fed7d7;
    color: #c53030;
}
